<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2024/6/1
  Time: 13:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>人物展示</title>
    <script type="text/javascript" src="../js/mouse.js"></script>
    <script>
        function goPage(pageNum) {
            //获取跳转到的input标签,将用户传递的参数设置给value属性
            document.getElementById('currentPage').value = pageNum;
            //获取当前页面只能够的from表单标签对象,调用方法完成提交
            document.forms[0].submit();
        }

        //当指定标签中的数据发生改变就进行一次提交
        function changePage() {
            document.forms[0].submit();
        }
    </script>
</head>
<body>
<h3 style="color: green">欢迎你:${USER_IN_SESSION.username}</h3>
<a href="/replaceImg.jsp">
    <img src="${USER_IN_SESSION.heading}" title="修改头像" height="50%">
</a><br>
<button><a href="/loginOut">安全退出</a></button>
<button><a href="/shuihu?userReq=input">添加</a></button>
<form method="post" action="/shuihu">
    关键字:<input type="text" name="keyword" value="${shqo.keyword}">
    武力值:<input type="text" name="minFighting" value="${shqo.minFighting}"> -
    <input type="text" name="maxFighting" value="${shqo.maxFighting}">
    <input type="submit" value="查询">
    <table border="1px" cellpadding="10px">
        <tr>
            <td>序号</td>
            <td>人物编号</td>
            <td>人物姓名</td>
            <td>武力值</td>
            <td>财富值</td>
            <td>所属势力编号</td>
            <td>操作</td>
        </tr>
        <c:forEach var="shuiHu" items="${pageResult.data}">
            <tr class="trCla">
                <td>${shuiHu.id}</td>
                <td>${shuiHu.pnum}</td>
                <td>${shuiHu.pname}</td>
                <td>${shuiHu.fighting}</td>
                <td>${shuiHu.riches}</td>
                <td>${shuiHu.deptNo}</td>
                <td>
                    <a href="/shuihu?userReq=delete&id=${shuiHu.id}">删除</a>
                    <a href="/shuihu?userReq=input&id=${shuiHu.id}">修改</a>
                </td>
            </tr>
        </c:forEach>
        <tr>
            <td colspan="8">
                <a href="#" onclick="goPage(1)">首页</a>
                <a href="#" onclick="goPage(${pageResult.prevPage})">上一页</a>
                <a href="#" onclick="goPage(${pageResult.nextPage})">下一页</a>
                <a href="#" onclick="goPage(${pageResult.totalPage})">尾页</a>
                当前第${shqo.currentPage} / ${pageResult.totalPage}页
                一共${pageResult.totalCount}条数据
                跳转到[
                <input type="text" name="currentPage" value="${shqo.currentPage}" id="currentPage"
                       onchange="changePage()">
                ]页
                每页[
                <select name="pageSize" onchange="changePage()">
                    <option value="3" ${shqo.pageSize == 3 ?'selected':''}>3</option>
                    <option value="5" ${shqo.pageSize == 5 ?'selected':''}>5</option>
                    <option value="7" ${shqo.pageSize == 7 ?'selected':''}>7</option>
                </select>
                ]条数据
            </td>
        </tr>
    </table>
</form>
</body>
</html>
